from tkinter import *
from view import *
from tkinter.messagebox import *

class Mainpage(object):
    def __init__(self,master=None):
        self.root=master
        self.root.geometry('600x500')
        self.createPage()

    def createPage(self):
         self.add_teacher=addTeacher(self.root)
         self.add_class=addClass(self.root)
         self.delete_teacher=deleteTeacher(self.root)
         self.delete_class=deleteClass(self.root)
         self.query_teacher=queryTeacher(self.root)
         self.query_class=queryClass(self.root)
         self.system=system_this(self.root)
         self.yourself=yourself_this(self.root)
         #self.label=Label(self.root,text='welcom').pack()
         self.add_teacher.pack()
         menubar=Menu(self.root)
         addmenu=Menu(menubar,tearoff=0)
         addmenu.add_command(label='教室',command=self.addclass)
         addmenu.add_command(label='老师',command=self.addteacher)
         menubar.add_cascade(label='增加',menu=addmenu)
         self.root['menu']=menubar
         querymenu=Menu(menubar,tearoff=0)
         querymenu.add_command(label='教室',command=self.queryclass)
         querymenu.add_command(label='老师',command=self.queryteacher)
         menubar.add_cascade(label='查询',menu=querymenu)

         deletemenu=Menu(menubar,tearoff=0)
         deletemenu.add_command(label='教室',command=self.deleteclass)
         deletemenu.add_command(label='老师',command=self.deleteteacher)
         menubar.add_cascade(label='删除',menu=deletemenu)
         menu=Menu(menubar,tearoff=0)
         menu.add_command(label='关于系统',command=self.system_func)
         menu.add_command(label='关于我们',command=self.self_func)
         menubar.add_cascade(label='帮助',menu=menu)

         quit_menu=Menu(menubar,tearoff=0)
         quit_menu.add_command(label='退出',command=self.quit)
         menubar.add_cascade(label='退出',menu=quit_menu)
    def system_func(self):
         self.yourself.pack_forget()
         self.add_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.add_teacher.pack_forget()
         self.system.pack_forget()
         self.system.pack()
    def self_func(self):
         self.add_class.pack_forget()
         self.system.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.add_teacher.pack_forget()
         self.yourself.pack_forget()
         self.yourself.pack()
    def quit(self):
        self.root.destroy()
    def addteacher(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.add_teacher.pack_forget()
         self.add_teacher.pack()
         
    def addclass(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_teacher.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.add_class.pack_forget()
         self.add_class.pack()
    def deleteteacher(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_teacher.pack_forget()
         self.add_class.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_teacher.pack()
    def deleteclass(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_teacher.pack_forget()
         self.add_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.delete_class.pack_forget()
         self.delete_class.pack()
    def queryteacher(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_teacher.pack_forget()
         self.add_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_teacher.pack()
    def queryclass(self):
         self.system.pack_forget()
         self.yourself.pack_forget()
         self.add_teacher.pack_forget()
         self.add_class.pack_forget()
         self.delete_teacher.pack_forget()
         self.delete_class.pack_forget()
         self.query_teacher.pack_forget()
         self.query_class.pack_forget()
         self.query_class.pack()
          
